<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/1/29 0029
 * Time: 上午 9:51
 */

namespace app\admin\controller;

use think\Controller;
use think\Request;
use think\Session;
use think\assign;

class Common  extends Controller
{
   /* public function __construct(Request $request = null)
    {
        /* parent::__construct($request);
         if(	!Session::get('admin_id')){

             $this->redirect('admin/login/login');
         }

    }*/
    //通用信息General information
    public  function  generalInfor($PageTitle)
    {
        //halt($PageTitle);
        $this->assign('PageTitle',$PageTitle);
    }
    //无限级分类
    public function GetTreecn($arr,$pid,$step,$pidname,$name){
        global $tree;
        foreach($arr as $key=>$val) {
            if($val[$pidname] == $pid) {
                $flg = str_repeat('└―',$step);
                $val[$name] = $flg.$val[$name];
                $tree[] = $val;
                $this->GetTree($arr,$val[$pidname],$step+1,$pidname,$name);
            }
        }
        return $tree;
    }

}